home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Internet Tools 1993 July / Internet Tools.iso / RockRidge / mail / sendmail / sendmail-5.65c+IDA-1.4.4.1 / ida / cf / DBM-Guide < prev    next >
Encoding:
Text File  |  1991-05-29  |  17.9 KB  |  440 lines

  1.  THE CARE AND FEEDING OF DBM DATABASES FOR THE IDA PACKAGE.
  2.  
  3.  The power of the IDA package derives mainly from its use of DBM databases 
  4. which can be looked up during the processing of mail.
  5.  
  6.  The DBM databases are set up to map a KEY into a VALUE.  In our descriptions 
  7. below we shall always presume that the source for building the database is 
  8. organized in the format:
  9.  
  10. VALUE    KEY [KEY] ...
  11.  
  12. This is usually the most convenient format.  However the output of the 
  13. pathalias program has a different format.  Notice that sendmail always 
  14. converts the key to lower case before doing a database lookup.
  15.  
  16.  The dbm command is sufficiently versatile to be able to handle either of 
  17. these source formats. 
  18.  
  19.  We start with an overview of the various tables.
  20.  
  21. =============================================================================
  22.  
  23.  MAILERTABLE:  This is probably the first table you will wish to define.  By 
  24.     default, mail directed to one of the PSEUDONYMs is processed by the 
  25.     LOCAL mailer, mail addressed to 'user@host.UUCP' is sent out by the UUCP 
  26.     mailer (but only if 'host' is a UUCP neighbor), mail to 
  27.     'user@full.domain.name' is sent out with the TCP mailer.  There is no 
  28.     default provision for handling mail to .BITNET hosts, to UUCP hosts which 
  29.     are not neighbors, etc.
  30.  
  31.     The MAILERTABLE allows this default processing to be changed for specific 
  32.     domains or classes of domains.
  33.  
  34.     The KEY in each entry is a domain name, or a partial domain name 
  35.     (beginning with a dot).  The VALUE is a MAILER/DOMAIN pair, in any of the 
  36.     formats 'MAILER,domain'  or 'MAILER:domain' or 'MAILER!domain'.  The 
  37.     choice of the separator (',' or ':' or '!') affects how the name address 
  38.     is processed after mailer selection.
  39.  
  40.     Example 1.  I have a UUCP neighbor 'denali'.  But this host is also on 
  41.     the network, and has in Internet mail name of 'math.niu.edu'.  Since it 
  42.     is more efficient to use the network, I can insert the entry:
  43.  
  44. TCP,math.niu.edu        denali.UUCP
  45.  
  46.     in my MAILERTABLE.  That way mail addressed via UUCP can actually be 
  47.     delivered via TCP.
  48.  
  49.     MAILERTABLE can also be used to deliver BITNET mail.  I can install the 
  50.     entry
  51.  
  52. TCP,UICVM.UIC.EDU       .BITNET
  53.  
  54.     in the table.  Then any mail which matches the .BITNET - that is, any 
  55.     mail to a 'host.BITNET' destination is forwarded to the nearby BITNET 
  56.     gateway, UICVM.UIC.EDU.
  57.  
  58.     uunet.uu.net is an Internet host.  Thus by default mail to there is 
  59.     processed by the TCP mailer.  But with the entry
  60.  
  61. TCP-U,uunet.uu.net      uunet.uu.net
  62.  
  63.     mail will be transmitted with the TCP-U mailer.  This is still a TCP 
  64.     mailer, but it is designed to provide UUCP format addresses.  This may
  65.     be appropriate for uunet which is a major UUCP forwarder.  However
  66.     uunet.uu.net is a well run host, and can recognize a variety of
  67.     formats, so the regular TCP mailer is also a good choice.
  68.  
  69.     The various mailers which can be selected by MAILERTABLE entries include 
  70.     the TCP mailer, the UUCP mailer, the TCP-U mailer just mentioned, the 
  71.     TCP-A mailer which uses strict RFC822 source routes, the UUCP-A mailer 
  72.     which uses UUCP transport but formats addresses in Internet style.  The 
  73.     local mailer could also be selected.
  74.  
  75.     In selecting a mailer, the mailer pair may be separated by any of ',' or 
  76.     ':' or '!'.  There significance is in the way the address is modified.  
  77.     If ',' is used, the recipient address is sent to the mailer unchanged.  
  78.     If a '!' is used, the recipient host is first removed from the recipient 
  79.     address before forwarding via the mailer.  The '!' is appropriate for the 
  80.     UUCP and LOCAL mailers which expect the recipient host to have been 
  81.     removed.  The use of ':' is somewhere between these two.  The recipient 
  82.     host is removed, but only if there are additional hosts in a mailing 
  83.     path.
  84.  
  85.     It is also possible to specify the MAILER-domain pair as just a ':'.  
  86.     This has the special meaning of forcing mailer selection to fail.  Such 
  87.     entries are useful in conjunction with PATHTABLE, discussed next.
  88.  
  89.  *********** IMPORTANT NOTE ****************
  90.  
  91.     It is important that host names in the MAILER:HOST pair be the OFFICIAL
  92.     host name.  Thus,
  93.  
  94. TCP,math.niu.edu    denali.UUCP
  95.  
  96.     is correct.
  97.  
  98. TCP,math        denali.UUCP
  99.  
  100.     is incorrect, even if 'niu.edu' is my local domain.  Likewise, when I
  101.     use the UUCP-A mailer to send Internet format mail via UUCP to our
  102.     Geology department, the record
  103.  
  104. UUCP-A!earth        geol.niu.edu
  105.  
  106.     is correct.  However
  107.  
  108. UUCP-A!earth.UUCP    geol.niu.edu
  109.  
  110.     would be incorrect.  This is because 'earth' is the official name of this
  111.     UUCP host, whereas 'earth.UUCP' is not the host name, but an internet-like
  112.     mailname sometimes used for the host.
  113.  
  114.     NOTES ON ADVANCED FEATURES OF MAILERTABLE.
  115.  
  116.     When you use a MAILERTABLE entry with a key beginning with '.', the
  117.     mailer/host pair can contain a '%s'.  The %s is replaced by that part
  118.     of the matching host name which precedes the key.  Thus an entry
  119.  
  120. Dmail,%s    .dnet
  121.  
  122.     would result in mail to  XYZZY.dnet being sent by the Dmail (Decnet)
  123.     mailer to decnet node XYZZY, which is the string to replace the %s.
  124.     Likewise you might use an entry like:
  125.  
  126. ACSNET,%s.oz    .oz
  127.  
  128.     to route all mail to *.oz hosts via the ACSNET mailer, while retaining
  129.     the full original domain name for the receiving host.
  130.  
  131.     SELECTING THE ERROR MAILER.
  132.  
  133.     If the mailer/host pair in a MAILERTABLE entry does not contain any
  134.     of the tokens ':' or ',' or '!', the ERROR mailer will be invoked.
  135.     This could be used for handling special error situations.  For example
  136.     I could use the entry:
  137.  
  138. "ANNEX1: Terminal server does not handle mail"        annex1.niu.edu
  139.  
  140.     Note that since the message is quoted, it is parsed as a single token,
  141.     so the ':' will not be recognized.  Mail to 'user@annex1.niu.edu' will
  142.     resolve to the error mailer as:
  143.     $#ERROR $:"ANNEX1: Terminal server does not handle mail"
  144.     (Of course this only affects mail for annex1 passing through this host,
  145.     since it would be silly to have an MX record where mail is not accepted.)
  146.  
  147.     Or you might create a mailertable entry:
  148.  
  149. "User mail privileges suspended"    mailsuspend
  150.  
  151.     and then in your aliases file you might have an alias
  152.  
  153. smith: "smith doesn't read mail.  His mailbox overfloweth"@mailsuspend
  154.  
  155.     to deal with a user whose mail habits are causing you headaches.
  156.  
  157. =============================================================================
  158.  
  159.  PATHTABLE
  160.  
  161.     This table is useful for rerouting mail.  Usually it is constructed from 
  162.     the UUCP map, using the pathalias command.
  163.  
  164.     The PATHTABLE is searched when the first attempt at selecting a mailer 
  165.     has failed.  Thus I can have an entry:
  166.  VALUE                          KEY
  167. seismo!%s@uunet.uu.net          seismo
  168.  
  169.     Suppose then that I have mail for 'user@seismo.UUCP'.  Since 'seismo' is 
  170.     not a UUCP neighbor, the first attempt at finding a mailer fails.  Then a 
  171.     PATHTABLE lookup is performed.  The domain name 'seismo' is used to 
  172.     lookup the table, and 'user' is sprintf-ed through the value, to yield an 
  173.     address 'seismo!user@uunet.uu.net'.  Note that 'user' could actually be a 
  174.     long bang path in this.  Note also that UUCP addresses are special for 
  175.     PATHTABLE, in that the '.UUCP' is not part of the key.  The special 
  176.     treatment derives from the history of the pathalias command for preparing 
  177.     UUCP maps.  
  178.  
  179.     However the PATHTABLE is not restricted to UUCP mail.  I could use an 
  180.     entry
  181.  
  182. %s@UICVM.UIC.EDU        .BITNET
  183.  
  184.     as an alternate way of routing BITNET mail via UICVM.  Since the key 
  185.     begins with a '.', the original domain is not removed.  Thus 
  186.     'user@host.BITNET' is converted into something like 
  187.     'user@host.BITNET@UICVM.UIC.EDU' except that the internal reformatting 
  188.     associated with PATHTABLE lookups will convert this to the RFC822 source 
  189.     route '@UICVM.UIC.EDU:user@host.BITNET'. 
  190.  
  191.  *********** IMPORTANT NOTE ****************
  192.  
  193.     It is essential that PATHTABLE entries, other than simple UUCP node names,
  194.     use the fully qualified names, since - except for the addition of '.UUCP'
  195.     to uucp hosts, the addresses coming from PATHTABLE are not subject to
  196.     later qualification.
  197.  
  198.     For entries generated from the UUCP maps with the pathalias command, this
  199.     will not be a problem, for they are already in the correct format.  But
  200.     if you manually add extra entries you must see that they too (except for
  201.     simple UUCP names) are fully qualified.
  202.  
  203.   VALUE            KEY
  204. uunet.uu.net!seismo%s    seismo
  205.  
  206.     or
  207.  
  208. seismo%s@uunet.uu.net    seismo
  209.  
  210.     is alright, because uunet.uu.net is fully qualified.
  211.  
  212. uxc!uunet%s        uunet.uu.net
  213.  
  214.     is alright, since uxc is a simple UUCP name.  But if I want to use
  215.     TCP to send mail to my UUCP neighbor 'denali', I must use
  216.  
  217. %s@math.niu.edu        denali
  218.  
  219.     not
  220.  
  221. %s@math            denali
  222.  
  223.     since 'math' is not fully qualified.
  224.  
  225.     FORCING PATHTABLE LOOKUPS.
  226.  
  227.     If you use a MAILERTABLE, you can force a PATHTABLE lookup for a
  228.     particular host with the MAILERTABLE entry:
  229.  
  230. :    host.name
  231.  
  232.     This is mostly useful for dealing with special routing problems.  If
  233.     for example, our VM system had a problem with its ethernet card, I
  234.     could use the mailertable entry
  235.  
  236. :    VM.CSO.NIU.EDU
  237.  
  238.     to force a PATHTABLE lookup, and then I could use the pathtable entry:
  239.  
  240. %s@NIUCS.BITNET        VM.CSO.NIU.EDU
  241.  
  242.     to temporarily reroute its mail via a BITNET link.
  243.  
  244. =============================================================================
  245.  
  246.  DOMAINTABLE
  247.  
  248.     This table is used to fully qualify domain names.  
  249.  
  250.     The domain qualification process uses both the name server and the domain 
  251.     table.  Thus if I send mail to 'person@niucs1' the name server lookup 
  252.     first attempts to append my default domain (from /etc/resolv.conf) of 
  253.     'niu.edu' forming the domain 'niucs1.niu.edu'.  Since there is a CNAME 
  254.     record in the domain database mapping this to the canonical name of 
  255.     'mp.cs.niu.edu', that becomes the fully qualified domain name used.  
  256.     Similarly, if I try sending mail to 'person@math' the domain is 
  257.     tentatively qualified with 'niu.edu', and since 'math.niu.edu' is a valid 
  258.     name known to the name server this becomes the fully qualified name.
  259.  
  260.     If, however, I send mail to 'person@chem' this procedure fails.  The name 
  261.     'chem.niu.edu' does have records in the domain database.  But the records 
  262.     are only MX records, and the lowest preference is to this host.  Since 
  263.     MX records of preference >= that of the local host must be discarded, it 
  264.     looks to the name server lookup as if 'chem.niu.edu' is an invalid name.  
  265.     This the name is not properly qualified.
  266.  
  267.     The solution is a DOMAINTABLE entry
  268.  
  269. chem.niu.edu       chem
  270.  
  271.     This entry maps the key 'chem' into its fully qualified version, so that 
  272.     the correct fully qualified name is still found.  Actually I prefer to 
  273.     use a table entry of
  274.  
  275. chem.niu.edu       chem  chem.niu.edu
  276.  
  277.     Here the key 'chem.niu.edu' is useful if sendmail wants to be sure that 
  278.     'chem.niu.edu' is a valid fully qualified name.  As mentioned above, the 
  279.     name server lookup will not validate the domain, so a DOMAINTABLE lookup 
  280.     must be used.
  281.  
  282.     Mail coming into my machine from the 'chem.niu.edu' machine arrives via 
  283.     UUCP.  In fact 'chem.niu.edu' has a UUCP name of 'socrates'.  The sender 
  284.     address on this mail will be in the form 'socrate!person'.  Because I 
  285.     used BANGIMPLIESUUCP in my setup, the domain is converted to 
  286.     'socrate.UUCP'.  I use the DOMAINTABLE entries:
  287.  
  288. chem.niu.edu       socrate.UUCP socrates.UUCP socrate socrates
  289.  
  290.     Thus the address 'socrate.UUCP' is automatically converted to its 
  291.     Internet equivalent of 'chem.niu.edu' before it leaves sendmail.
  292.     Note that I include both 'socrate.UUCP' and 'socrates.UUCP' as keys.  The 
  293.     actual machine name is 'socrates' but much UUCP software truncates names 
  294.     to 7 characters.  For safety I use both versions.  I also include 
  295.     'socrate' and 'socrates' without the '.UUCP' so that if I ever stop using 
  296.     BANGIMPLIESUUCP correct qualification will still occur.
  297.  
  298.     As a general rule, you should only have entries in DOMAINTABLE for direct 
  299.     UUCP connections, and for local machines (machines within your domain).  
  300.     There may be special local circumstances which would cause you to add a 
  301.     few additional entries.  You do not need to qualify every domain in the 
  302.     world. 
  303.  
  304. =============================================================================
  305.  
  306.  UUCPXTABLE
  307.  
  308.     This table is used to convert full domain names into UUCP names.  For 
  309.     example I use an entry
  310.  
  311. socrates      chem.niu.edu
  312.  
  313.     This is used to convert the name 'chem.niu.edu' into the corresponding 
  314.     UUCP name of 'socrates'.  The idea is that the host should always be 
  315.     known as 'chem.niu.edu' when Internet format addresses are preferred, 
  316.     such as with the TCP mailer.  But when UUCP format addresses are 
  317.     preferred, as with the UUCP mailer, it is better to use the UUCP name.
  318.  
  319.     As a general guide, whenever there is a DOMAINTABLE entry to convert your 
  320.     UUCP neighbor's name into a full domain name, there should be a 
  321.     corresponding UUCPXTABLE entry so that the UUCP name is still used with 
  322.     the UUCP mailer. 
  323.  
  324. =============================================================================
  325.  
  326.  DECNETXTABLE
  327.  
  328.     This is used for DECNET mail.  Its use is somewhat analogous to the use 
  329.     of UUCPXTABLE for UUCP mail.  See Sendmail.mc for more information.
  330.  
  331. =============================================================================
  332.  
  333.  GENERICFROM
  334.  
  335.     This table only effects addresses on the 'From:' header line.  If, for 
  336.     example, I had an entry:
  337.  
  338. Neil-Rickert@cs.niu.edu      rickert
  339.  
  340.     then mail sent out by 'rickert' would have its 'From:' line read as 
  341.     'From: Neil-Rickert@cs.niu.edu'.
  342.  
  343.     Note that the program 'xalparse' allows a single source file 'xaliases' to 
  344.     be used to build both the ALIASES and the GENERICFROM databases.
  345.  
  346. =============================================================================
  347.  
  348.  NOTES ON MX-GATEWAYING.
  349.  
  350.  A number of hosts do not have direct Internet connections, but use Internet
  351. style addresses, and have mail reach them with the aid of an MX domain
  352. record and a forwarding gateway machine.  These notes give some approaches to
  353. using this setup.
  354.  
  355.  If you are not Internet connected, but use UUCP to forward mail to an MX
  356. gatewaying machine, try using UUCP-A as the RELAY_MAILER.  Beyond setting
  357. up the relaying mailer and host there is little for you to do, for most of
  358. the setup must be handled on the gateway machine.
  359.  
  360.  The rest of these notes apply to the gateway machine.
  361.  
  362.  There are two problems to consider.  We must forward received mail to the
  363. machine for which we gateway.  And we must send mail from that machine onto
  364. the network.  We consider the problems separately.
  365.  
  366.  Handling incoming mail from Internet:
  367.  
  368.     Firstly you will want to ensure that there is an MX record in
  369.     the domain database, making your host the lowest preference mail
  370.     exchanger for the host.  As an example, my host (mp.cs.niu.edu)
  371.     provides MX gatewaying for the domain 'art.niu.edu'.
  372.  
  373.     Next decide which mailer to use for the domain.  In the case of
  374.     'art.niu.edu', they are able to handle Internet addresses, so I
  375.     use the UUCP-A mailer which uses UUCP transport, but Internet
  376.     style addresses.  The connecting machine is 'laotzu.art.niu.edu' and
  377.     has a UUCP name of 'laotzu'.  I use the following entry in my
  378.     mailer table:
  379.  
  380. UUCP-A!laotzu    art.niu.edu
  381.  
  382.     This causes mail to be forwarded via the UUCP-A mailer.  If there were
  383.     an MX record for addresses *.art.niu.edu I would also include an
  384.     entry
  385.  
  386. UUCP-A,laotzu    .art.niu.edu
  387.  
  388.     which would forward all such mail (addressed to 'host.art.niu.edu')
  389.     for 'laotzu' to handle.
  390.  
  391.     If the domain does not understand Internet style addresses, you should
  392.     use the UUCP mailer, instead of the UUCP-A mailer.  In this case it is
  393.     also a good idea to include a UUCPXTABLE entry
  394.  
  395. laotzu    art.niu.edu
  396.  
  397.     The has the effect of translating the Internet name into a UUCP name,
  398.     so that the domain (art.niu.edu) does not even need to deal with
  399.     Internet format addresses on incoming mail.  In fact if you have such
  400.     a UUCPXTABLE entry you don't need a MAILERTABLE entry, for the
  401.     UUCPXTABLE entry will already select the UUCP mailer for you.
  402.  
  403.     Another approach is to handle the forwarding purely with PATHTABLE.  If
  404.     there is a PATHTABLE entry with KEY = 'art.niu.edu' and
  405.     VALUE = 'laotzu!%s', mail to this domain should be handled correctly.
  406.     This works because, since your host has the lowest MX preference, the
  407.     first attempt to find a mailer fails and the PATHTABLE is consulted.
  408.     This approach is particularly attractive if you do MX forwarding for
  409.     many domains.  The advantage is that those domains can manage their
  410.     own PATHTABLE entries by submitting UUCP MAPS to the UUCP MAP project
  411.     (uucpmap@rutgers.edu).  Of course this assumes you keep up to date
  412.     maps and run pathalias regularly to build your PATHTABLE.
  413.  
  414.  Handling outgoing mail to the Internet:
  415.  
  416.     This depends on how the domain handles its own addresses.  It
  417.     will need to be set up to use a relay mailer and relay all
  418.     Internet format mail to your host.  The best solution is for the
  419.     host to format its outgoing addresses in Internet style.  In that
  420.     case you need do nothing.  For example, in the case of 'art.niu.edu',
  421.     the machine currently is a Sun work station.  It uses the 'smartuucp'
  422.     mailer as its relay mailer, but the mailer definition has been altered
  423.     to remove the 'U' flag so that pure Internet style addresses are used.
  424.     This works partly because I use the version of 'rmail' in 'ida/aux'
  425.     for my rmail, and run it suid to root.  This version of 'rmail' does
  426.     not get confused when given internet style addresses.
  427.  
  428.     If, however, 'laotzu' was unable to handle Internet style addresses
  429.     at all for its own domain name, I would include a DOMAINTABLE entry
  430.  
  431. art.niu.edu    laotzu.UUCP    laotzu
  432.  
  433.     Then incoming mail from laotzu would automatically have its address
  434.     converted (by DOMAINTABLE) to Internet format before sending it out
  435.     to Internet.
  436.  
  437.  
  438.   ----
  439.   Neil Rickert <rickert@cs.niu.edu>
  440.